package vip.huhailong.thumbnailatorstudy.config;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import vip.huhailong.thumbnailatorstudy.entiry.Rs;
import vip.huhailong.thumbnailatorstudy.utils.RsUtil;

@RestControllerAdvice
public class GlobalException {

    private static final Logger logger = LoggerFactory.getLogger(GlobalException.class);

    @ExceptionHandler(Exception.class)
    public Rs handleException(Exception e){
        logger.error(e.getMessage());
        return RsUtil.error(e.getMessage());
    }
}
